<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: BaseSerializer
  
    &mdash; Ruby China API 文档
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "BaseSerializer";
  relpath = '';
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="class_list.html"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="_index.html">Index (B)</a> &raquo;
    
    
    <span class="title">BaseSerializer</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <iframe id="search_frame" src="class_list.html"></iframe>

      <div id="content"><h1>Class: BaseSerializer
  <span class="abstract note title">Abstract</span>
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">ActiveModel::Serializer</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveModel::Serializer</li>
          
            <li class="next">BaseSerializer</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>app/serializers/base_serializer.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <div class="note abstract">
  <strong>This class is abstract.</strong>
  <div class='inline'></div>
</div>


  </div>
</div>
<div class="tags">
  

</div><div id="subclasses">
  <h2>Direct Known Subclasses</h2>
  <p class="children"><span class='object_link'><a href="NodeSerializer.html" title="NodeSerializer (class)">NodeSerializer</a></span>, <span class='object_link'><a href="NotificationSerializer.html" title="NotificationSerializer (class)">NotificationSerializer</a></span>, <span class='object_link'><a href="ReplySerializer.html" title="ReplySerializer (class)">ReplySerializer</a></span>, <span class='object_link'><a href="TopicSerializer.html" title="TopicSerializer (class)">TopicSerializer</a></span>, <span class='object_link'><a href="UserSerializer.html" title="UserSerializer (class)">UserSerializer</a></span></p>
</div>







  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#abilities-instance_method" title="#abilities (instance method)">#<strong>abilities</strong>  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>当前 accessToken 对应的用户对此数据的权限.</p>
</div></span>
  
</li>

      
    </ul>
  


  

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="abilities-instance_method">
  
    #<strong>abilities</strong>  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>当前 accessToken 对应的用户对此数据的权限</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
        <p class="example_title"><div class='inline'>
<p>表示可修改，不可删除</p>
</div></p>
      
      <pre class="example code"><code>
<span class='lbrace'>{</span> <span class='label'>update:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>destroy:</span> <span class='kw'>false</span> <span class='rbrace'>}</span></code></pre>
    
  </div>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


11
12
13
14
15
16
17
18
19
20
21</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/serializers/base_serializer.rb', line 11</span>

<span class='kw'>def</span> <span class='id identifier rubyid_abilities'>abilities</span>
  <span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>update:</span> <span class='id identifier rubyid_can?'>can?</span><span class='lparen'>(</span><span class='symbol'>:update</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='label'>destroy:</span> <span class='id identifier rubyid_can?'>can?</span><span class='lparen'>(</span><span class='symbol'>:destroy</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span> <span class='rbrace'>}</span>

  <span class='comment'># More actions for Topic
</span>  <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Topic</span><span class='rparen'>)</span>
    <span class='qsymbols_beg'>%i(</span><span class='tstring_content'>ban</span><span class='words_sep'> </span><span class='tstring_content'>excellent</span><span class='words_sep'> </span><span class='tstring_content'>unexcellent</span><span class='words_sep'> </span><span class='tstring_content'>close</span><span class='words_sep'> </span><span class='tstring_content'>open</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_action'>action</span><span class='op'>|</span>
      <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_can?'>can?</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>
  <span class='id identifier rubyid_res'>res</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Oct 20 19:35:17 2016 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.5 (ruby-2.3.1).
</div>

    </div>
  </body>
</html>